package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.CourseNoticeMapper;
import com.ruoyi.yljf.domain.CourseNotice;
import com.ruoyi.yljf.service.ICourseNoticeService;

import javax.annotation.Resource;

/**
 * 笔记Service业务层处理
 * 
 * @author metaee
 * @date 2025-03-26
 */
@Service
public class CourseNoticeServiceImpl extends ServiceImpl<CourseNoticeMapper, CourseNotice> implements ICourseNoticeService {
    @Resource
    private CourseNoticeMapper courseNoticeMapper;
    
    /**
     * 查询笔记列表
     * 
     * @param courseNotice 笔记
     * @return 笔记
     */
    @Override
    public List<CourseNotice> selectCourseNoticeList(CourseNotice courseNotice) {
    	LambdaQueryWrapper<CourseNotice> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(courseNotice.getUserId())) {
			queryWrapper.eq(CourseNotice::getUserId, courseNotice.getUserId());
		}
        if (StringUtils.isNotEmpty(courseNotice.getUserName())) {
			queryWrapper.like(CourseNotice::getUserName, courseNotice.getUserName());
		}
        if (StringUtils.isNotEmpty(courseNotice.getAvatar())) {
			queryWrapper.eq(CourseNotice::getAvatar, courseNotice.getAvatar());
		}
        if (StringUtils.isNotNull(courseNotice.getCurId())) {
			queryWrapper.eq(CourseNotice::getCurId, courseNotice.getCurId());
		}
        if (StringUtils.isNotEmpty(courseNotice.getName())) {
			queryWrapper.like(CourseNotice::getName, courseNotice.getName());
		}
        if (StringUtils.isNotEmpty(courseNotice.getNoticeContent())) {
			queryWrapper.eq(CourseNotice::getNoticeContent, courseNotice.getNoticeContent());
		}
        if (StringUtils.isNotNull(courseNotice.getLikes())) {
			queryWrapper.eq(CourseNotice::getLikes, courseNotice.getLikes());
		}
        if (StringUtils.isNotNull(courseNotice.getCreatTime())) {
			queryWrapper.eq(CourseNotice::getCreatTime, courseNotice.getCreatTime());
		}
        return courseNoticeMapper.selectList(queryWrapper);
    }
}
